﻿using System.Collections.ObjectModel;

namespace LightCAD.Core
{
    public enum ComponentRefType
    {
        /// <summary>
        /// 单引用，如墙、风管、水管等等
        /// </summary>
        SingleRef = 0,
        /// <summary>
        /// 实例引用，如门、窗、设备等等
        /// </summary>
        InstanceRef = 1
    }
    public class ComponentDefinition : LcadObject
    {
        public string Uuid { get; set; }
        public string Name { get; set; }
        public string Display { get; set; }
        public string Descr { get; set; }

        public ComponentRefType RefType { get; set; }

        public PluginDefinition PluginDef { get; set; }
        public PropertyDefinitionCollection ArgsDef { get; set; }

        
    }
    public class ComponentDefinitionMap : KeyedCollection<string, ComponentDefinition>
    {
        protected override string GetKeyForItem(ComponentDefinition item)
        {
            return item.Uuid;
        }
    }


    public class ComponentInstance : ElementContainer
    {

        public ComponentDefinition ComDef { get; set; }
        public PropertyCollection Args { get; set; }

        public string GetKey()
        {
            return Args.GetKey();
        }
    }

    public class ComponentInstanceCollection : KeyedCollection<string, ComponentInstance>
    {
        protected override string GetKeyForItem(ComponentInstance item)
        {
            return item.GetKey();
        }
    }





    public class ComponentManager
    {
        public ComponentManager(LcDocument doc)
        {
        }
    }

}